1. Field of the Invention
The present invention relates to an apparatus and a method for writing data onto a tape medium, and more particularly, to an apparatus and a method for writing data in a buffer onto a tape medium according to a command from a host apparatus.
2. Background Information
A tape drive for writing data onto a tape medium such as a magnetic tape temporally stores data in a buffer and writes the data from the buffer to the tape medium at the timing which is convenient for the tape drive. A host sends a command for forcibly writing the data (WriteFM Non Immediate command) to the drive to ensure that all the data that has been sent to the drive is written out onto the tape medium. Such forcible writing from the buffer to the tape medium is called “synchronization”.
If the tape medium is not stopped immediately after the synchronization, a gap is left on the tape medium between data that is written during preceding synchronization and subsequently written data. That wastes the recording area on the tape medium. That is why a backhitch needs to be performed. The backhitch refers to a series of operations such as slowing down the rewinding of the tape medium, temporally stopping the tape medium, rewinding the tape medium in the reverse direction, and then rewinding the tape medium in the original direction again to the location into which writing is to be performed, and writing the next piece of data. The next piece of data cannot be written until the backhitch is completed. As the backhitch takes about two or three seconds, involving the backhitch significantly influences the performance.
Various techniques to avoid the backhitch have been proposed. One technique involves a plurality of blocks of various sizes which are sent from a host apparatus are sequentially stored into a buffer which is divided into segments of a certain size, and when a segment is prepared by at least one block, the content of the segment is written onto a tape medium as a data set, and if the next segment is not prepared while the tape medium is rewound for four meters, a Null data set is written onto the tape medium within the four meters.
Some types of application program product that are used at a host apparatus serially send a first command, which instructs to forcibly write data in a buffer onto a tape medium, and a second command, which instructs to write delimiter information onto the tape medium, as commands to instruct the “synchronization”. In such a case, as the data in the buffer is forcibly written out onto the tape medium according to the first command, the backhitch is involved. Further, as the delimiter information needs to be written onto the tape medium according to the second command, the backhitch is performed again. As writing of the next piece of data cannot start until the backhitch has been performed, performing the backhitch twice significantly influences the performance.
Thus, it would be desirable to reduce probability of involving backhitch twice when a command, which instructs to forcibly write data in a buffer onto a tape medium, and a command, which instructs to write delimiter information onto the tape medium are sent in serial.